<!DOCTYPE html>
<html lang="en">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<meta http-equiv="cache-control" content="max-age=0" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
	<meta http-equiv="pragma" content="no-cache" />
<title>平台审核 - 维修店详情</title>
<script src="<%=basePath%>weixin/js/jquery.min.js"></script>
<script src="<%=basePath%>weixin/js/mui.min.js"></script>
<script src="<%=basePath%>weixin/js/mui.previewimage.min.js"></script>
<script src="<%=basePath%>weixin/module/layer/layer.js"></script>
<link rel="stylesheet" href="<%=basePath%>weixin/css/mui.min.css" />
<link rel="stylesheet" href="<%=basePath%>weixin/css/base.css" />
<link rel="stylesheet" href="<%=basePath%>weixin/css/style.css" />
<link rel="stylesheet" href="<%=basePath%>weixin/css/order.css" />
</head>
<body class="bg-f5">
	<div class="container-box m-top-30">
		<div class="row-box">
			<div class="data-box">
				<div class="data-img">
					<img src="<%=basePath%>${srm.imgpath}" onerror="this.src='<%=basePath%>weixin/img/p.png'" alt="头像" />
				</div>
				<div class="data-text">
					<div>${srm.nickname}</div>
					<p class="phone"><i></i>${srm.tel}</p>
					<p class="date"><i></i>${srm.addtime}</p>
				</div>
				<span class="status-icon">
					<c:if test="${srm.audit_flag == '0'}">
						<img src="<%=basePath%>weixin/img/icon/5.png" width="100%" />
					</c:if>
					<c:if test="${srm.audit_flag == '1'}">
						<img src="<%=basePath%>weixin/img/icon/2.png" width="100%" />
					</c:if>
					<c:if test="${srm.audit_flag == '2'}">
						<img src="<%=basePath%>weixin/img/icon/4.png" width="100%" />
					</c:if>
					<c:if test="${srm.audit_flag == '-1'}">
						<img src="<%=basePath%>weixin/img/icon/3.png" width="100%" />
					</c:if>
					<c:if test="${srm.audit_flag == '-2'}">
						<img src="<%=basePath%>weixin/img/icon/1.png" width="100%" />
					</c:if>
				</span>
			</div>
		</div>
		<div class="row-box input-group bg-white m-top-20 data-details">
			<div class="mui-card bg-none">
				<ul class="mui-table-view bg-none">
					<li class="mui-table-view-cell mui-collapse">
						<a class="mui-navigate-right" href="#">
							<div class="input-group-item">
								<div class="input-group-icon"><i class="data-i data-i-1"></i></div>
								<div class="input-group-title text-color-3">
									身份证号
								</div>
								<div class="input-group-text">
									${srm.cardno}
								</div>
							</div>
						</a>
						<div class="mui-collapse-content">
							<div class="img-upload">
								<img src="<%=basePath%>${srm.frontpath}" width="100" class="img-load" alt="身份证正面" data-preview-src="" data-preview-group="1" />
								<img src="<%=basePath%>${srm.sidepath}" width="100" class="img-load" alt="身份证反面" data-preview-src="" data-preview-group="1" />
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse">
						<a class="mui-navigate-right" href="#">
							<div class="input-group-item">
								<div class="input-group-icon"><i class="data-i data-i-2"></i></div>
								<div class="input-group-title text-color-3">
									营业执照号
								</div>
								<div class="input-group-text">
									${srm.regname}
								</div>
							</div>
						</a>
						<div class="mui-collapse-content">
							<div class="img-upload">
								<img src="<%=basePath%>${srm.certpath}" width="100" class="img-load" alt="营业执照" data-preview-src="" data-preview-group="1" />
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
		<div class="row-box input-group bg-white m-top-20 data-details">
			<div class="input-group-item">
				<div class="input-group-icon"><i class="data-i data-i-3"></i></div>
				<div class="input-group-title text-color-6">
					经营姓名
				</div>
				<div class="input-group-text">
					${srm.operator}
					<c:if test="${srm.operator==null || srm.operator==''}">
						${srm.nickname}
					</c:if>
				</div>
			</div>
			<div class="input-group-item">
				<div class="input-group-icon"><i class="data-i data-i-4"></i></div>
				<div class="input-group-title text-color-6">
					店铺名称
				</div>
				<div class="input-group-text">
					${srm.storename}
				</div>
			</div>
			<div class="input-group-item">
				<div class="input-group-icon"><i class="data-i data-i-5"></i></div>
				<div class="input-group-title text-color-6">
					店铺地址
				</div>
				<div class="input-group-text">
					${srm.province_name}${srm.city_name}${srm.area_name}${srm.town_name}${srm.address}
				</div>
			</div>
			<div class="input-group-item">
				<div class="input-group-icon"><i class="data-i data-i-6"></i></div>
				<div class="input-group-title text-color-6">
					联系人
				</div>
				<div class="input-group-text">
					${srm.contacts}
					<c:if test="${srm.contacts==null || srm.contacts==''}">
						${srm.nickname}
					</c:if>
				</div>
			</div>
			<div class="input-group-item">
				<div class="input-group-icon"><i class="data-i data-i-7"></i></div>
				<div class="input-group-title text-color-6">
					联系电话
				</div>
				<div class="input-group-text">
					${srm.tel1}
					<c:if test="${srm.tel1==null || srm.tel1==''}">
						${srm.tel}
					</c:if>
				</div>
			</div>
			<c:if test="${hostUser != null && hostUser.nickname !=''}" >
				<div class="input-group-item">
					<div class="input-group-icon"><i class="data-i data-i-3"></i></div>
					<div class="input-group-title text-color-6">
						推荐人
					</div>
					<div class="input-group-text">
							${hostUser.nickname}<c:if test="${hostUser.user_type == '5'}">(服务商)</c:if><c:if test="${hostUser.user_type == '1'}">(维修店)</c:if>
					</div>
				</div>
			</c:if>
			<c:if test = "${srm.audit_flag == '-1' || srm.audit_flag == '-2' }">
				<div class="input-group-item">
					<div class="input-group-icon"><i class="data-i data-i-1"></i></div>
					<div class="input-group-title text-color-6">
						拒绝原因
					</div>
					<div class="input-group-text">
						<span style="color:red;">${srm.audit_describe}</span>
					</div>
				</div>
			</c:if>

		</div>
		<c:if test="${srm.audit_flag == '0' || srm.audit_flag == '1'}">
		<div class="text-center">
			<a id="refuse"   class="m-btn m-top-30 m-bottom-30 m-right-10" >拒绝</a>
			<a id="consent"  class="m-btn m-top-30 m-bottom-30 m-left-10"  >同意</a>
		</div>
		</c:if>
	</div>
	<div id="picture" class="mui-popover mui-popover-action mui-popover-bottom actionBox">
		<ul class="mui-table-view">
			<li class="mui-table-view-cell">
				<a>拒绝理由</a>
			</li>
			<li class="mui-table-view-cell">
				<input type="text" id="describe" placeholder="请填写拒绝理由" />
			</li>
			<li class="mui-table-view-cell">
				<a href="#picture" id="submitCk">确定</a>
			</li>
		</ul>
	</div>
	<script>
		var ckFlag = true;
		(function(mui){
			mui.init();
			mui.previewImage();
			var refuse = document.querySelector('#refuse');
			var consent = document.querySelector('#consent');
			var submitCk = document.querySelector('#submitCk');
			refuse.addEventListener('tap',function(){
				mui('#picture').popover('toggle');
				$("#submitCk").attr("sign","-2");
			});
			consent.addEventListener('tap',function(){
				var btnArray = ['否', '是'];
				mui.confirm('确定审核通过吗？', '平台审核', btnArray, function(e) {
					if (e.index == 1) {
						ajaxAuditStatus('2');
					}
				})
			});
			submitCk.addEventListener('tap',function(){
				var btnArray = ['否', '是'];
				mui.confirm('确定当前审核操作吗？', '平台审核', btnArray, function(e) {
					if (e.index == 1) {
						var describe = $("#describe").val();
						if(describe==""){
							mui.toast("请填写拒绝理由");
							return ;
						}
						ajaxAuditStatus('-2');
					}
				})
			});

		})(mui);

		function ajaxAuditStatus(status){
			if(!ckFlag){
				return ;
			}
			ckFlag = false;
			var userId = "${srm.user_id}";
			var describe = "";
			if(status =='-2' || status == -2 ){
				describe = $("#describe").val();
			}
			$.ajax({
				type:"POST",
				url:"<%=basePath%>ajax/wx/audit/status",
				data:{
					'userId' : userId,
					'auditFlag' : status,
					'auditDescribe' : describe,
					'tm':new Date().getTime()
				},
				dataType:'json',
				cache: false,
				async: false,
				success: function(data){
					if(data.code==1){
						window.location.href ="<%=basePath%>/api/wx/kmb/audit/list";
					} else {
						alert(data.mem);
						ckFlag = true;
					}
				}, error: function(XMLHttpRequest, textStatus, errorThrown) {
					alert(XMLHttpRequest.status+" | "+XMLHttpRequest.readyState+"|"+textStatus);
					ckFlag = true;
				}
			});
		}

	</script>
</body>
</html>
